package com.example.statesaver;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.EditText;

public class MainActivity extends Activity {
	
	EditText textInput;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		textInput = (EditText) findViewById(R.id.text_input);
		
		if(savedInstanceState != null &&
			savedInstanceState.containsKey("text_input")){
			textInput.setText(savedInstanceState.getString("text_input"));
		}
	}
	
	@Override
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putString("text_input", textInput.getText().toString());
	}

}
